//
//  UIView+IBInspectable.swift
//  weibo002
//
//  Created by 黑眼圈 on 16/4/16.
//  Copyright © 2016年 heiyan. All rights reserved.
//

import UIKit

//titleFind.layer.cornerRadius = 5
//titleFind.layer.masksToBounds = true
//titleFind.layer.borderColor = UIColor.redColor().CGColor
//titleFind.layer.borderWidth = 3

extension UIView {
    
    
    //切圆角
    @IBInspectable var cornerRadius:CGFloat{
        
        get{
            
            return self.layer.cornerRadius
            
        }
        
        set{
            
            self.layer.cornerRadius = newValue
            
            if newValue>0 {
                self.layer.masksToBounds = true
            }
        }
        
    }
    
    //边框颜色
    @IBInspectable var borderColor:UIColor?{
        
        get{
            
            if let bc = self.layer.borderColor {
                
                 return UIColor(CGColor: bc)
            }
            
           return nil
        }
        
        set{
            
            self.layer.borderColor = newValue?.CGColor
            
        }
        
    }
    
    //边框宽度
    @IBInspectable var borderWidth:CGFloat{
        
        get{
            
            return self.layer.borderWidth
        }
        
        set{
        
            self.layer.borderWidth = newValue
        }
    }
    
    
    
    
    
    
    
    
    
    
}